/**
 * Copyright (C)  2011  chen wei hua.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 2.0
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU Free Documentation License".
 */
package com.javaeye.procurement.dto;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import com.javaeye.common.dto.DTO;

public class MaterialsReceiveOrder implements DTO {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 6894920169941893269L;
	
	public static final int ORDER_STATES_CREATED = 0;
	
	public static final int ORDER_STATES_RECEIVED = 1;
	
	public static final int ORDER_STATES_CREATED_UNQUALIFIED = 2;
	
	public static final int ORDER_STATES_CHECK_QUALIFIED = 3;
	
	public static final int ORDER_STATES_IN_STORE = 4;

	private String id;//rkyyyyMMddXX
	
	private String supplierOrderId;
	
	private Date createDate;
	
	private Date arriveDate;
	
	private Date realArriveDate;
	
	private String supplierName;
	
	private int supplierId;
	
	private String contractNo;
	
	private double totleAmount;
	
	private int status;
	
	private Date updateDate;

	private Set<MaterialsReceiveOrderDetail> orderDetails = new HashSet<MaterialsReceiveOrderDetail>();
	
	public void addDetail(MaterialsReceiveOrderDetail detail) {
		detail.setOrder(this);
		orderDetails.add(detail);
	}
	
	public void removeDetail(MaterialsReceiveOrderDetail detail) {
		orderDetails.remove(detail);
		detail.setOrder(null);
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Date getArriveDate() {
		return arriveDate;
	}

	public void setArriveDate(Date arriveDate) {
		this.arriveDate = arriveDate;
	}

	public String getSupplierName() {
		return supplierName;
	}

	public void setSupplierName(String supplierName) {
		this.supplierName = supplierName;
	}

	public int getSupplierId() {
		return supplierId;
	}

	public void setSupplierId(int supplierId) {
		this.supplierId = supplierId;
	}

	public String getContractNo() {
		return contractNo;
	}

	public void setContractNo(String contractNo) {
		this.contractNo = contractNo;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}
	
	public String getStatusName() {
		switch(status) {
		case ORDER_STATES_CREATED:
			return "等待收货";
		case ORDER_STATES_RECEIVED:
			return "等待检验";
		case ORDER_STATES_CREATED_UNQUALIFIED:
			return "不合格等待入库";
		case ORDER_STATES_CHECK_QUALIFIED:
			return "合格等待入库";
		case ORDER_STATES_IN_STORE:
			return "已经入库";
		default:
			return "";
		}
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Set<MaterialsReceiveOrderDetail> getOrderDetails() {
		return orderDetails;
	}

	public void setOrderDetails(Set<MaterialsReceiveOrderDetail> orderDetails) {
		this.orderDetails = orderDetails;
	}

	public void setTotleAmount(double totleAmount) {
		this.totleAmount = totleAmount;
	}

	public double getTotleAmount() {
		return totleAmount;
	}

	public void setSupplierOrderId(String supplierOrderId) {
		this.supplierOrderId = supplierOrderId;
	}

	public String getSupplierOrderId() {
		return supplierOrderId;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setRealArriveDate(Date realArriveDate) {
		this.realArriveDate = realArriveDate;
	}

	public Date getRealArriveDate() {
		return realArriveDate;
	}
	
}
